
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <ul>
      <li v-for="(v, k) in obj">
        {{v}}
      </li>
    </ul>
    <button @click="modify">修改</button>
    <button @click="add">增加</button>
  </div>
  <script type="text/javascript" src="js/vue.js"></script>
  <script type="text/javascript">
    var vm = new Vue({
      el: '#app',
      data: {
        obj: {
          name: 'zhangsan',
          age: 19
        }
      },
      methods: {
        modify: function() {
          this.obj.name = 'lisi'
          this.obj.age = 29
        },
        add: function(){
          //this.obj.gender = 'male'
          this.$set(this.obj,'gender',"male")
        }
      }
    });
    // 点击修改的按钮, 观察界面
    // 点击增加的按钮, 观察界面, 如何解决出现的问题?
     //对象增加删除属性不会触发响应式更新
  </script>
</body>
</html>
